package com.amao.ws.websocket.code;

import javax.websocket.CloseReason.CloseCode;

/**
 * 
 * @author jgd
 * @date 2018-06-05 17:16:16
 * @detail websocket状态码4000–4999保留给应用使用,看接口文档，websocket状态码
 * @version 1.0.0
 */
public class CustomClose implements CloseCode{
	
	//4000-4999表示自定义正常连接关闭
	public static final int    CLOSE_CODE_MIX                              = 4000;//最小,无实际意义
	
	public static final int    CLOSE_CODE_UN_KNOW_TYPE                     = 4001;//未知账号类型
	public static final String REASONPHRASE_UN_KNOW_TYPE                   = "unknow type";
	
	public static final int    CLOSE_CODE_UN_REGIST                        = 4002;//未注册
	public static final String REASONPHRASE_UN_REGIST                      = "unregist";
	
	public static final int    CLOSE_CODE_FORCE_OFF_LINE                   = 4003;//强制掉线，不在同一台机的时候，多端登录
	public static final String REASONPHRASE_FORCE_OFF_LINE                 = "force off line";
	
	public static final int    CLOSE_CODE_SAME_SERVER_FORCE_OFF_LINE       = 4004;//强制掉线，同在一台机的时候，多端登录
	public static final String REASONPHRASE_SAME_SERVER_FORCE_OFF_LINE     = "force off line";
	
	public static final int    CLOSE_CODE_ERROR_CONNECTION                 = 4005;//异常链接
	public static final String REASONPHRASE_ERROR_CONNECTION               = "exception connection";
	
	public static final int    CLOSE_CODE_UN_AUTH                          = 4006;//未认证
	public static final String REASONPHRASE_UN_AUTH                        = "auth fail,try again";
	
	public static final int    CLOSE_CODE_MAX                              = 4999;//最大,无实际意义

	private int closeCode;
	
	public CustomClose(int closeCode){
		this.closeCode = closeCode;
	}

	@Override
	public int getCode() {
		return this.closeCode;
	}

}
